#include "QuantizationMatrix.h"

QuantizationMatrix::QuantizationMatrix()
{

}

QuantizationMatrix::QuantizationMatrix(int columnLength)
{
    _columnLength = columnLength;
    _size = columnLength*columnLength;
    _quantizationMatrix = new int[_size];
    for(int i=0; i < _size; ++i)
        _quantizationMatrix[i] = 1;
}

QuantizationMatrix::QuantizationMatrix(const QuantizationMatrix &qm)
{
    _columnLength = qm.columnLength();
    _size = qm.size();
    _quantizationMatrix = new int[_size];
    for(int i=0; i < _size; ++i )
        _quantizationMatrix[i] = qm[i];
}

void QuantizationMatrix::setMatrix(int *matrix)
{
    for(int i=0; i < _size; ++i)
        _quantizationMatrix[i] = matrix[i];
}

void QuantizationMatrix::setMatrixRowMajor(int *matrix)
{
    for(int i=0; i < _columnLength; ++i)
        for(int j=0; j < _columnLength; ++j)
            _quantizationMatrix[i*_columnLength+j] = matrix[j*_columnLength+i];
}

void QuantizationMatrix::setMatrix(uint8_t *matrix)
{
    for(int i=0; i < _size; ++i)
        _quantizationMatrix[i] = (int)matrix[i];
}
